﻿@model CampaignModel

@Html.HiddenFor(model => model.Id)
@Html.ValidationSummary(false)

@if (Model.Id > 0)
{
	<div class="alert alert-warning">
		@T("Admin.Promotions.Campaigns.Warning")
	</div>
}

@Html.SmartStore().TabStrip().Name("campaign-edit").Style(TabsStyle.Material).Items(x =>
{
	x.Add().Text(T("Admin.Common.General").Text).Content(TabGeneral()).Selected(true);
	x.Add().Text(T("Admin.Common.Stores").Text).Content(TabStores());
    
    //generate an event
    EngineContext.Current.Resolve<IEventPublisher>().Publish(new TabStripCreated(x, "campaign-edit", this.Html, this.Model));
})

@helper TabGeneral()
{
	<table class="adminContent">
		<tr>
			<td class="adminTitle">
				@Html.SmartLabelFor(model => model.Name)
			</td>
			<td class="adminData">
				@Html.EditorFor(model => model.Name)
				@Html.ValidationMessageFor(model => model.Name)
			</td>
		</tr>
		<tr>
			<td class="adminTitle">
				@Html.SmartLabelFor(model => model.Subject)
			</td>
			<td class="adminData">
				@Html.EditorFor(model => model.Subject)
				@Html.ValidationMessageFor(model => model.Subject)
			</td>
		</tr>
        <tr>
            <td class="adminTitle">
                @Html.SmartLabelFor(model => model.LastModelTree)
            </td>
            <td class="adminData">
                @Html.EditorFor(model => model.LastModelTree, "ModelTree")
            </td>
        </tr>
		<tr>
			<td class="adminTitle">
				@Html.SmartLabelFor(model => model.Body)
			</td>
			<td class="adminData wide">
				@Html.EditorFor(model => model.Body, "Html", new { lazy = false })
				@Html.ValidationMessageFor(model => model.Body)
			</td>
		</tr>
	</table>
}

@helper TabStores()
{
	@Html.Partial("StoreSelector", Model)
}